package com.neusoft.tijian.service.impl;

import java.util.List;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.neusoft.tijian.mapper.OrdersMapper;
import com.neusoft.tijian.po.Orders;
import com.neusoft.tijian.service.OrdersService;

@Service
@Slf4j
public class OrdersServiceImpl implements OrdersService{

	@Autowired
	private OrdersMapper ordersMapper;

	/**
	 * 查询订单
	 * @param userId
	 * @return
	 */
	@Override
	public int getOrdersByUserId(String userId) {
		log.info("查询订单信息,userId：{}",userId);
		return ordersMapper.getOrdersByUserId(userId);
	}

	/**
	 * 保存订单，预约成功的。
	 * @param orders
	 * @return
	 */
	@Override
	public int saveOrders(Orders orders) {
		return ordersMapper.saveOrders(orders);
	}

	/**
	 * 查看订单
	 * @param orders
	 * @return
	 */
	@Override
	public List<Orders> listOrdersByUserId(Orders orders) {
		return ordersMapper.listOrdersByUserId(orders);
	}

	/**
	 * 取消预约
	 * @param orderId
	 * @return
	 */
	@Override
	public int removeOrders(Integer orderId) {
		return ordersMapper.removeOrders(orderId);
	}
	
	@Override
	public Orders getOrdersById(Integer orderId) {
		return ordersMapper.getOrdersById(orderId);
	}
}
